//
//  Z_FindingTableViewCell.m
//  SpaceMovie
//
//  Created by nana on 15/3/17.
//  Copyright (c) 2015年 nana. All rights reserved.
//

#import "Z_FindingTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation Z_FindingTableViewCell
- (void)dealloc
{
    [_commentLabel release];
    [_timeLabel release];
    [_timeLabel release];
    [_introduceLabel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.image = [[UIImageView alloc] initWithFrame:(CGRectMake(5, 10, self.frame.size.width / 3, self.frame.size.width / 3 + 20))];
        _image.userInteractionEnabled = YES;
        [self.contentView addSubview:_image];
        [_image release];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:(CGRectMake(self.frame.size.width / 3 + 10, 20, self.frame.size.width / 2 + 40, 45))];
        _titleLabel.font = [UIFont systemFontOfSize:18];
        [self.contentView addSubview:_titleLabel];
        [_titleLabel release];
        
        self.introduceLabel = [[UILabel alloc] initWithFrame:(CGRectMake(self.frame.size.width / 3 + 10, 70, self.frame.size.width / 2 + 40, 20))];
//        [_introduceLabel setBackgroundColor:[UIColor blackColor]];
        _introduceLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_introduceLabel];
        [_introduceLabel release];
        
        self.timeLabel = [[UILabel alloc] initWithFrame:(CGRectMake(self.frame.size.width / 3 + 10, 115, 100, 20))];
        [self.contentView addSubview:_timeLabel];
        [_timeLabel release];
        
        self.commentLabel = [[UILabel alloc] initWithFrame:(CGRectMake(255, 115, 70, 20))];
        [self.contentView addSubview:_commentLabel];
        [_commentLabel release];

    }
    return self;
}

- (void)setAllValues:(Z_FindingNewModel *)findingNewModel
{
    [_image setImageWithURL:[NSURL URLWithString:findingNewModel.findingNew_imagePath]];
    NSString *time = [NSString stringWithFormat:@"%@", findingNewModel.findingNew_publishTime];
    _timeLabel.text = time;
    _titleLabel.text = findingNewModel.findingNew_title;
    _introduceLabel.text = findingNewModel.findingNew_title2;
    NSString *comment = [NSString stringWithFormat:@"评论  %@", findingNewModel.findingNew_commentCount];
    _commentLabel.text = comment;
    
//    NSNumber *num = findingNewModel.findingNew_type;
//    NSInteger i = [num integerValue];
//    if (i == 2) {
//        UIImage *img = [UIImage imageNamed:@"3.png"];
//        UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
//        imgView.frame = CGRectMake(40, 50, 30, 30);
//        [self.image addSubview:imgView];      
//    }
    

    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
